package com.ssmdemo.utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.HttpEntity;

import java.io.Serializable;


public class ResponseEntity<E> implements Serializable {

    /**
     * 状态码
     */
    private Integer state;
    /**
     * 描述信息
     */
    private String message;
    /**
     * 数据
     */
    private E data;

    public ResponseEntity() {

    }

    public ResponseEntity(Integer state) {
        this.state = state;
    }

    public ResponseEntity(Integer state, String message, E data) {
        this.state = state;
        this.message = message;
        this.data = data;
    }

    public ResponseEntity(String message, E data) {
        this.message = message;
        this.data = data;
    }

    public ResponseEntity(Throwable e) {
        this.message = e.getMessage();
    }

    public ResponseEntity(Integer state, E data) {
        this.state = state;
        this.data = data;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }
}
